home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / MM2_DEV / S / TEST / MOUSEBUT.M < prev    next >
Encoding:
Text File  |  1993-07-14  |  1.2 KB  |  46 lines

  1.  
  2. (*
  3. stuerzt ab, sobald eine Maustaste gedrueckt wird. Es erscheint noch eine Box:
  4. *)
  5.  
  6. MODULE VInError;
  7. (* VDI-Inputs Error: Wird eine Maustaste gedrueckt, stuerzt der Rechner ab *)
  8. FROM GEMEnv IMPORT InitGem, RC, DeviceHandle;
  9. FROM GEMGlobals IMPORT MouseButton, MButtonSet;
  10. FROM MOSGlobals IMPORT MemArea, MEM;
  11. FROM VDIInputs  IMPORT ButChgVecCarrier, InstallButChgProc, RemoveButChgProc;
  12. FROM SYSTEM IMPORT ASSEMBLER;
  13. FROM InOut IMPORT Write, WriteLn, WriteString, WriteInt, WriteCard, Read;
  14.  
  15. VAR
  16.   handle : ButChgVecCarrier;
  17.   stack  : ARRAY [1..2048] OF CARDINAL;  (* 4 KByte Stack *)
  18.   count  : LONGCARD;
  19.   ch: CHAR;
  20.   pressed: CARDINAL;
  21.   fl, ok: BOOLEAN;
  22.   dev: DeviceHandle;
  23.   
  24.   PROCEDURE WasClicked( VAR mbut: MButtonSet ) : BOOLEAN;
  25.   BEGIN
  26.     INC (pressed);
  27.     fl:= ~fl;
  28.     RETURN fl
  29.   END WasClicked;
  30.  
  31.  
  32. BEGIN
  33.   (*
  34.   InitGem (RC, dev, ok);
  35.   *)
  36.   fl:= FALSE;
  37.   pressed:= 0;
  38.   InstallButChgProc( handle, WasClicked, MEM(stack) );
  39.   FOR count:=1 TO 5000000 DO (* nix *) END;
  40.   RemoveButChgProc(handle);
  41.   WriteString ("Maustaste wurde ");
  42.   WriteCard (pressed, 0);
  43.   WriteString (" mal gedrückt/losgelassen.");
  44.   Read (ch);
  45. END VInError.
  46.